package com.wt.struggle.goodbye.info

import android.os.Parcel
import android.os.Parcelable

class MessageInfo() : Parcelable {

    var fromUserInfo: ProUserInfo? = null
    var toUserInfo: ProUserInfo? = null
    var appUserExtraInfo: ProUserInfo? = null

    var id: Int? = 0
    var type: Int? = 0
    var status: Int? = 0
    var title: String? = ""
    var content: String? = ""
    var createTime: String? = ""
    var commentId: Int = 0
    var fromId: Int = 0
    var toId:Int=0

    var subCommentInfoList: ArrayList<MessageInfo>? = null

    constructor(parcel: Parcel) : this() {
        fromUserInfo = parcel.readParcelable(ProUserInfo::class.java.classLoader)
        toUserInfo = parcel.readParcelable(ProUserInfo::class.java.classLoader)
        id = parcel.readValue(Int::class.java.classLoader) as? Int
        type = parcel.readValue(Int::class.java.classLoader) as? Int
        status = parcel.readValue(Int::class.java.classLoader) as? Int
        title = parcel.readString()
        content = parcel.readString()
        createTime = parcel.readString()
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeParcelable(fromUserInfo, flags)
        parcel.writeParcelable(toUserInfo, flags)
        parcel.writeValue(id)
        parcel.writeValue(type)
        parcel.writeValue(status)
        parcel.writeString(title)
        parcel.writeString(content)
        parcel.writeString(createTime)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<MessageInfo> {
        override fun createFromParcel(parcel: Parcel): MessageInfo {
            return MessageInfo(parcel)
        }

        override fun newArray(size: Int): Array<MessageInfo?> {
            return arrayOfNulls(size)
        }
    }

}